<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><spring:message  code="pim"/> - <spring:message  code="homepage.project"/>&nbsp;<c:out value="${bean.project.name}"></c:out> - <spring:message  code="title.project.my.task"/></title>
<link href="<%= request.getContextPath() %>/css/custom.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/v.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/jquery.ui.all.css" rel="stylesheet" >
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.6.2.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-ui-1.8.14.custom.js"></script>
<%@include file="script/sort-table.jsp" %>
<%@include file="script/pim-util.jsp" %>
<%@include file="script/task-script.jsp" %>
<script type="text/javascript">
var TSort_Data = new Array ('mytable','', 's','s','s', 's', 's','s','s','s');
tsRegister();
</script>
</head>
<body>
<c:if test="${bean.isSigned == true}">
<div id="all">
<div id="wrapper">
<div id="mainheader">
	<jsp:include page="include/common/headerSignedIn.jsp" />
</div> 
<div id="content-wrapper">
<div id="top-menu">
    <jsp:include page="include/common/topMenuHome.jsp" />
</div>
<div class="workspace-menu-top">
    <c:choose>
	    <c:when test="${bean.isAdmin == true}">
	      <jsp:include page="include/common/admin-menu.jsp" />
	    </c:when>
	    <c:otherwise>
	      <jsp:include page="include/common/user-menu.jsp" />
	    </c:otherwise>
	</c:choose>
</div> 

<div class="tabs-content v-row">
<div class="v-row"> 
    <div class="v-row-left" style="margin-left: 10px;">
			<span class="v-title">
				<spring:message  code="title.project.my.task" />
			</span>
	</div>    
</div>
<form:form action="" method="post" name="myTasks" commandName="taskQuery">	 
<div>
<table class="width100 v-table">
<tbody>
		<tr class="v-table-row-0">
		    <td valign="top"><spring:message  code="task.reporter" /></td>
		    <td valign="top"><spring:message  code="task.monitoredby" /></td>		   
		    <td valign="top"><spring:message  code="task.assignedto" /></td>
			<td valign="top"><spring:message  code="title.task.category" /></td>
		</tr>

		<tr class="v-table-row-1">	
		     <td valign="top">
			    <form:select path="reporter" cssClass="v-select-small">
                        <option value=""><spring:message  code="title.any" /></option>
                        <c:forEach var="member" items="${bean.members}">
                         <option value="${member.visa}"
                         <c:if test="${taskQuery.reporter == member.visa}">
                                     selected="selected"
                               </c:if> >
                               <c:out value="${member.visa}" />
                         </option>
                        </c:forEach>
                </form:select>	
		    </td>	
		    <td valign="top">
			    <form:select path="monitoredby" cssClass="v-select-small">
                        <option value=""><spring:message  code="title.any" /></option>
                        <c:forEach var="member" items="${bean.members}">
                         <option value="${member.visa}"
                         <c:if test="${taskQuery.monitoredby == member.visa}">
                                     selected="selected"
                               </c:if> >
                               <c:out value="${member.visa}" />
                         </option>
                        </c:forEach>
                </form:select>	
		   </td>		   	    		   	   
		    <td valign="top">
			    <form:select path="assignedto" cssClass="v-select-small">
                        <option value=""><spring:message  code="title.any" /></option>
                        <c:forEach var="member" items="${bean.members}">
                         <option value="${member.visa}"                            
                               <c:if test="${(bean.visa == member.visa)
                                     ||(taskQuery.assignedto == member.visa)}">
                                     selected="selected"
                               </c:if> >
                               <c:out value="${member.visa}" />
                         </option>
                        </c:forEach>
                </form:select>	
		   </td>		    
			<td valign="top">
			    <form:select path="categoryId" cssClass="v-select-small">
                        <option value="0"><spring:message  code="title.any" /></option>
                        <c:forEach var="category" items="${bean.categories}">
                         <option value="${category.categoryid}"
                               <c:if test="${taskQuery.categoryId == category.categoryid}">
                                     selected="selected"
                               </c:if> >
                               <c:out value="${category.name}" />
                         </option>
                        </c:forEach>
                </form:select>	
		   </td>		  		    
		</tr>

		<tr class="v-table-row-0">
		    <td valign="top"><spring:message  code="title.task.severity" /></td>
		    <td valign="top"><spring:message  code="title.task.priority" /></td>
		    <td valign="top"><spring:message  code="title.task.status.show" /></td>
			<td valign="top"><spring:message  code="title.task.status.hide" /></td>
		</tr>

		<tr class="v-table-row-1">	
		    <td valign="top">
				<form:select path="severityId" cssClass="v-select-small">
                        <option value="0"><spring:message  code="title.any" /></option>
                        <c:forEach var="severity" items="${bean.severities}">
	                         <option value="${severity.severityid}"
	                               <c:if test="${taskQuery.severityId == severity.severityid}">
	                                     selected="selected"</c:if>>
	                               <c:out value="${severity.name}" />
	                         </option>
                        </c:forEach>
                </form:select>	
		    </td>		    	   
		    <td valign="top">
	             <form:select path="priorityId" cssClass="v-select-small">
                        <option value="0"><spring:message  code="title.any" /></option>
                        <c:forEach var="priority" items="${bean.priorities}">
                         <option value="${priority.priorityid}"
                               <c:if test="${taskQuery.priorityId == priority.priorityid}">selected="selected"</c:if>>
                               <c:out value="${priority.name}" />
                         </option>
                        </c:forEach>
                </form:select>	
		    </td>		    
			<td valign="top">
		        <form:select path="showStatusId" cssClass="v-select-small">
                        <option value="0"><spring:message  code="title.any" /></option>
                        <c:forEach var="status" items="${bean.statuses}">
                         <option value="${status.statusid}"
                               <c:if test="${taskQuery.showStatusId == status.statusid}">selected="selected"</c:if>>
                               <c:out value="${status.name}" />
                         </option>
                        </c:forEach>
                </form:select>	
		    </td>			
			<td valign="top">
			    <form:select path="hideStatusId" cssClass="v-select-small">
                        <option value="0"><spring:message  code="title.any" /></option>
                        <c:forEach var="status" items="${bean.statuses}">
                         <option value="${status.statusid}"
                               <c:if test="${taskQuery.hideStatusId == status.statusid}">selected="selected"</c:if>>
                               <c:out value="${status.name}" />
                         </option>
                        </c:forEach>
                </form:select>	
		    </td>				    
		</tr>
			
        <tr class="v-table-row-0">           
	        <td valign="top"><spring:message code="task.phase" /></td> 
	        <td valign="top"><spring:message code="title.task.starttime"/></td> 
	         <td valign="top"><spring:message code="title.task.endtime" /></td>
	        <td valign="top"><spring:message  code="title.show" /></td>
        </tr>
        
       <tr class="v-table-row-1">  	              		    
		    <td valign="top">
		        <form:select path="phase" cssClass="v-select-small">
		                <option value=""><spring:message  code="title.any" /></option>
                        <c:forEach var="phase" items="${bean.phases}">
                         <option value="${phase.name}"
                               <c:if test="${taskQuery.phase == phase.name}">selected="selected"</c:if>>
                               <c:out value="${phase.name}" />
                         </option>
                        </c:forEach>
		        </form:select>	
		    </td>		    		    
		    <td valign="top">
		        <form:input path="starttime" cssClass="v-input-small"/>
		    </td>	
		     <td valign="top">
		        <form:input path="endtime" cssClass="v-input-small"/>
		    </td>	    		    
		    <td valign="top">
		        <form:select path="itemsPerPage" cssClass="v-select-small">
		          <option value="0"><spring:message  code="title.any" /></option>
		          <c:forEach var="item" items="${bean.items}">
                         <option value="${item}"
                               <c:if test="${taskQuery.itemsPerPage == item}">selected="selected"</c:if>>
                               <c:out value="${item}" />
                         </option>
                  </c:forEach>
		        </form:select>
		    </td>		    		    	    
       </tr>

	   <tr class="v-table-row-0">
			<td>
				<input type="button" value="<spring:message code="button.filter"/>" id="filter" class="bt-form" name="filter">
			</td>									
			<td>			
				<input type="button" value="<spring:message code="button.reset"/>" id="reset"  class="bt-form" name="reset">	
		    </td>		    
		    <td colspan="2"/>				
		</tr>
</tbody>
</table>
</div>
<br/>
<div>
<div class="v-row">	
	 <c:choose>
		 <c:when test="${bean.countList==0}">
		     <span class="v-title">
		           <spring:message code="title.project.list.task" /></span>  (0 - 0/0)
		 </c:when>
		 <c:otherwise>
		     <span class="v-title">
		           <spring:message code="title.project.list.task" /></span>  (1 - ${bean.countList}/${bean.countList})
		</c:otherwise>
     </c:choose>
</div>	  	  
<table id="mytable" class="width100 v-table" cellspacing="1">
    <thead> 
	  <tr class="v-table-header">
	      <td width="10%">#</td>
	      <td width="15%"><spring:message  code="title.task.category" /></td>
	      <td width="15%"><spring:message  code="title.task.status" /></td>
	      <td width="30%"><spring:message code="title.task.summary" /></td>
	      <td width="10%"><spring:message  code="task.reporter" /></td>
		  <td width="10%"><spring:message  code="task.assignedto" /></td>	     	     
	      <td width="10%"><spring:message  code="title.task.priority" /></td>
      </tr>  
    </thead> 
	<tbody>
      <c:choose>
		<c:when test="${bean.countList == 0}">
		<tr>
			<td colspan="8" class="v-warning-message">
				<spring:message code="search.empty" />
			</td>
		</tr>
		</c:when>
      <c:otherwise>
	  <c:forEach items="${bean.tasks}" var="task" varStatus="count">
	    <tr bgcolor="${task.taskStatus.color}">
	    <td scope="row">
	       <div style="text-align: center;">
			    <a href="taskDetail.htm?pnum=${bean.project.number}&tcode=${task.code}">${task.code}</a>
			    <br/>
			    <a style="padding-right: 5px;" href="updateTask.htm?pnum=${bean.project.number}&tcode=${task.code}">
			     <img alt='<spring:message code="project.update.task"/>' 
			          title='<spring:message code="project.update.task"/>'  
			          src="<%=request.getContextPath()%>/images/editIcon.gif">
			    </a>			
		   </div>	
		</td>
		<td class="v-text-cell" scope="row"><c:out value="${task.taskCategory.name}" /></td>
		<td class="v-text-cell" scope="row"><c:out value="${task.taskStatus.name}" /></td>
		<td class="v-text-cell" scope="row"><c:out value="${task.summary}" /></td>
		<td class="v-text-cell" scope="row"><c:out value="${task.reporter}" /></td>
		<td class="v-text-cell" scope="row"><c:out value="${task.assignedto}" /></td>				
		<td class="v-text-cell" scope="row"><c:out value="${task.taskPriority.name}" /></td>								
        </tr>
	  </c:forEach>
	  </c:otherwise>
	  </c:choose>						  				
	</tbody>
</table>
</div>
<input type="hidden" name="visa" value="${bean.visa}"/>
<input type="hidden" name="cmd"/>
<input type="hidden" name="pnum" value="${bean.project.number}"/>
<input type="hidden" name="returnToFullPageURL" value="${bean.returnToFullPageURL}"/>
</form:form>
</div>
</div>
<div class="menu-task-color v-row">
    <jsp:include page="include/task/menu-task-color.jsp" />
</div>
<div class="footer">
	<jsp:include page="include/common/footer.jsp" />
</div>
</div>
</div>
</c:if>
</body>
</html>
